{extend name="adminheader:header"/}
{block name="content"}
	<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                	<div class="ibox-title">
                        <h5>修改子类</h5>
                    </div>
                    <div class="ibox-content">
                        <form action="{:url('/admin/Category/editChildPost')}" method="post" class="form-horizontal js-ajax-form m-t">
                            <input type="hidden" name="id" value="{$list.id}"/>                            <div class="form-group">
                                <label class="col-sm-3 control-label">商品分类名称</label>
                                <div class="col-sm-8">
                                    <input name="name" type="text" class="form-control" value="{$list.name}" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">分类图<span class="form-required">*</span></label>
                                <div class="col-md-6 col-sm-10">
                                    <input type="hidden" name="pic" id="thumbnail" value="{$list.pic|default=''}">
                                    <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                                        {if condition="empty($list.pic)"}
                                            <img src="/static/img/default-thumbnail.png" id="thumbnail-preview" width="100" height="100" style="cursor: pointer"/>
                                        {else/}
                                            <img src="{:getPreviewUrl($list.pic)}" id="thumbnail-preview" width="100" height="100" style="cursor: pointer"/>
                                        {/if}
                                    </a>
                                    <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-3">
                                    <button class="btn btn-primary js-ajax-submit" type="submit">添加</button>
                                    <a class="btn btn-default" href="{:url('/admin/Category/index')}">返回</a>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script src="/admin/js/admin.js"></script>
<script type="text/javascript">
    $(function () {

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src','/static/img/default-thumbnail.png');
            $('#thumbnail').val('');
        });
    });
</script>
{/block}